/*!
 * fullpage.js Parallax Effect Extension 0.2.0 for fullPage.js v3
 * https://github.com/alvarotrigo/fullPage.js
 *
 * @license This code has been bought from www.alvarotrigo.com/fullPage/extensions/ and it is not free to use or distribute.
 * Copyright (C) 2016 alvarotrigo.com - A project by Alvaro Trigo
 */
/* eslint-disable */
window.fp_parallaxExtension=function(){var f,d,n,c,o,p,s,l,e,t,i=this,u=window.fp_utils,a=window.fullpage_api,v=u.$,r=a.getFullpageData(),m=r.options,g=r.internals,x=".fullpage-wrapper",h="active",E="."+h,b=".fp-section",S=b+E,y="fp-slide",w="."+y,L=w+E,A="fp-notransition",M=".fp-bg",N="reveal",R="cover",T="fp-parallax-stylesheet",I="fp-parallax-transitions",C="#"+I,z="fp-parallax-transition-class",O="#"+z,B=0,H=!1,F=!1,k=!0,q=!0,W=!1,_=!1,V=!1,G=!1,X=!1,Y=!0===m.parallax||"slides"===m.parallax,D=!0===m.parallax||"sections"===m.parallax,P=u.closest,U=u.addClass,$=u.removeClass,j=u.hasClass,J=u.css,K=u.nextAll,Q=u.prevAll;function Z(e){return{cover:{offsetNormal:e?0:d},reveal:{offsetNormal:e?-d:0}}}function ee(e){return{cover:{offsetNormal:e?0:n},reveal:{offsetNormal:e?-n:0}}}function te(e){return e*c/100}function ne(e){return e*o/100}function oe(){return window.innerWidth||document.documentElement.clientWidth||document.getElementsByTagName("body")[0].clientWidth}function ie(){s&&Le(v(S).length?v(S)[0]:v(b)[0],0)}function ae(){if(D){var e=v(S).length?v(S)[0]:v(b)[0],t=f===N,n=t?K(e):Q(e),o=t?Q(e):K(e);n.forEach(function(e){Le(e,Z(t)[f].offsetNormal,"silent")}),o.forEach(function(e){Le(e,0,"silent")})}Y&&v(b).forEach(function(e){v(w,e).length&&re(v(L,e).length?v(L,e)[0]:v(w,e)[0])})}function re(e){var t=f===N,n=t?K(e):Q(e),o=t?Q(e):K(e);n.forEach(function(e){Ae(e,ee(t)[f].offsetNormal,"silent")}),o.forEach(function(e){Ae(e,0,"silent")})}function le(e){var t=e.detail;o=oe(),t&&!m.scrollBar?(xe(),he()):Ee()}function se(e){i.destroy(),W=!1}function fe(){v(".fp-scrollable").forEach(function(e){var t=v(M,e)[0];(v(".fp-scrollable",e).length||j(e,"fp-scrollable"))&&null!=t&&u.prependTo(e.parentNode,t)})}function de(e){e.detail?Ee():G=!0}function ce(e){e.detail,v(M).forEach(function(e){e.setAttribute("data-final-x",0),e.setAttribute("data-final-y",0)}),p=v(b),ae()}function pe(e){e.detail.leavingSection,e.detail.destination,F=X=!0}function ue(e){var t=e.detail.leavingSection,n=e.detail.destination;Le(t,Z(H)[f].offsetNormal,"silent");var o=v(w,t);o.length&&o.forEach(function(e){e!==n&&Le(e,0,"silent")}),i.afterSlideLoads(v(w,t)[0]),X=!1}function ve(e){var t=e.detail;_=!0,re("left"===t.xMovement?v(w,v(S)[0])[0]:u.last(v(w,v(S)[0]))),setTimeout(function(){i.applyHorizontal(t)})}function me(e){var t=e.detail;V=!0,ae(),setTimeout(function(){i.apply(t)})}function ge(){W&&(m.scrollBar||!m.autoScrolling||g.usingExtension("dragAndMove"))&&function(){var e=g.usingExtension("dragAndMove")?Math.abs(window.fp_dragAndMoveExtension.getCurrentScroll()):u.getScrollTop(),t=e<B,n=u.index(v(S)[0],b),o=c+e;B=e;for(var i=0;i<p.length;++i){var a=p[i],r=c+a.offsetTop;!t&&a.offsetTop<=o?n=i:t&&e<=r&&a.offsetTop<e&&p.length>i+1&&(n=i+1)}var l=(c-(p[n].offsetTop-e))*d/c;f!==N&&(n-=1);var s=f!==N?l:-d+l;-1<n&&Le(v(b)[n],s),0<=n-1&&Le(p[n-1],Z(!1)[f].offsetNormal),void 0!==p[n+1]&&Le(p[n+1],Z(!0)[f].offsetNormal)}()}function xe(){var e=".fp-bg{transition: transform "+m.scrollingSpeed+"ms "+m.easingcss3+";}.fp-slide, .fp-section{transition: background-position "+m.scrollingSpeed+"ms "+m.easingcss3+";}";m.autoScrolling&&!m.scrollBar&&Me(I,e)}function he(){var e=".fp-bg-animate{ transition: all "+m.scrollingSpeed+"ms "+m.easingcss3+"}";Me(z,e)}function Ee(){u.remove(v(C))}function be(){clearTimeout(t),t=setTimeout(Se,350)}function Se(){c=u.getWindowHeight(),o=oe(),d=te(m.parallaxOptions.percentage),n=ne(m.parallaxOptions.percentage),ie(),ae(),ye()}function ye(){J(v(M),{height:c+"px"})}function we(e){return Math.round(2*e)/2}function Le(e,t,n){var o=we(t),i=v(w,e);if(i.length){var a=v(L,e)[0];e=null!=a?a:i[0]}if(s)J(e,{"background-position-y":o+"px"});else if(!j(e,y)||j(e,h)||void 0!==n){var r=v(M,e)[0];if(r){var l=null!=r.getAttribute("data-final-x")?r.getAttribute("data-final-x"):0;u.toggleClass(r,A,void 0!==n),J(r,{transform:"translateX("+l+"px) translateY("+o+"px)"}),r.setAttribute("data-final-x",l),r.setAttribute("data-final-y",o)}}}function Ae(e,t,n){var o=we(t),i=s?e:v(M,e)[0];if(i)if(!m.scrollBar&&m.autoScrolling||U(i,"fp-bg-animate"),s)u.toggleClass(i,A,void 0!==n),J(i,{"background-position-x":o+"px"});else{var a=0,r=i.getAttribute("data-final-y");"none"!==r&&null!=r&&(a=r),u.toggleClass(i,A,void 0!==n||X),J(i,{transform:"translateX("+o+"px) translateY("+a+"px)"}),i.setAttribute("data-final-x",o),i.setAttribute("data-final-y",a)}}function Me(e,t){if(!v("#"+e).length){var n=document.head||document.getElementsByTagName("head")[0];u.appendTo((o=e,i=t,(a=document.createElement("style")).type="text/css",a.id=o,a.styleSheet?a.styleSheet.cssText=i:a.appendChild(document.createTextNode(i)),a),n)}var o,i,a}e=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame,window.requestAnimationFrame=e,i.apply=function(e){if(D&&(G&&xe(),!e.localIsResizing&&!m.scrollBar&&m.autoScrolling))if(("up"===e.yMovement||e.sectionIndex)&&(!e.isMovementUp||e.leavingSection-1)||!m.continuousVertical||V){var t=Z(H="up"===e.yMovement)[f].offsetNormal;Le(v(b)[e.sectionIndex],0),Le(v(b)[e.leavingSection-1],t),k=1===Math.abs(e.leavingSection-1-e.sectionIndex);for(var n=Math.min(e.leavingSection-1,e.sectionIndex)+1;n<Math.max(e.leavingSection-1,e.sectionIndex);n++)Le(v(b)[n],0,"silent")}else;},i.applyHorizontal=function(e){if(Y&&(!e.localIsResizing||X)&&"none"!=e.xMovement)if((l=void 0!==e.direction&&e.direction!==e.xMovement)&&m.continuousHorizontal&&!_)l=!1;else{var t=ee(F=l?"left"===e.direction:"left"===e.xMovement)[f].offsetNormal;if(Ae(v(w,e.section)[e.slideIndex],0),Ae(v(w,e.section)[e.prevSlideIndex],t),!(q=1===Math.abs(e.slideIndex-e.prevSlideIndex))&&!X)for(var n=Math.min(e.slideIndex,e.prevSlideIndex)+1;n<Math.max(e.slideIndex,e.prevSlideIndex);n++)Ae(v(w,e.section)[n],0,"silent")}},i.init=function(){var e;c=u.getWindowHeight(),o=oe(),f=m.parallaxOptions.type,d=te(m.parallaxOptions.percentage),n=ne(m.parallaxOptions.percentage),p=v(m.sectionSelector),s="background"===m.parallaxOptions.property,ye(),(e=v(x)[0]).addEventListener("setAutoScrolling",le),e.addEventListener("destroy",se),e.addEventListener("onScroll",ge),e.addEventListener("afterResponsive",ce),e.addEventListener("onGrab",de),e.addEventListener("onContinuousVertical",me),e.addEventListener("onResize",be),e.addEventListener("afterRender",fe),e.addEventListener("afterRebuild",fe),e.addEventListener("onResetSliders",pe),Y&&e.addEventListener("onContinuosHorizontal",ve),e.addEventListener("onEndResetSliders",ue),s||(Me(T,".fp-bg{top:0;bottom:0;width: 100%;position:absolute;z-index: -1;}.fp-section, .fp-slide, .fp-section.fp-table, .fp-slide.fp-table, .fp-section .fp-tableCell, .fp-slide .fp-tableCell {position:relative;overflow: hidden;}"),xe()),he(),ie(),ae(),W=!0},i.destroy=function(){Ee(),u.remove(v(O)),d=te(0),n=ne(0),v(b).length&&(ae(),u.css(v(M),{height:""})),clearTimeout(t);var e=v(x)[0];e&&(e.removeEventListener("setAutoScrolling",le),e.removeEventListener("destroy",se),e.removeEventListener("onScroll",ge),e.removeEventListener("afterResponsive",ce),e.removeEventListener("onGrab",de),e.removeEventListener("onContinuousVertical",me),e.removeEventListener("onResize",be),e.removeEventListener("afterRender",fe),e.removeEventListener("afterRebuild",fe),e.removeEventListener("onResetSliders",pe),Y&&e.removeEventListener("onContinuosHorizontal",ve),e.removeEventListener("onEndResetSliders",ue))},i.setOption=function(e,t){"offset"===e?(m.parallaxOptions.percentage=t,d=te(t),n=ne(t)):"type"===e&&(m.parallaxOptions.type=t,f=t),ae()},i.applyProperties=Le,i.afterSlideLoads=function(e){var t,n=void 0!==e?e:v(L,v(S)[0])[0],o=P(n,b);if((s?(t=o,v(w,t).length?v(w,t):[t]):v(M,o)).forEach(function(e){$(e,"fp-bg-animate")}),(_||l)&&(re(n),_=!1),!q){var i=ee(F)[f].offsetNormal,a=n,r=F?K(a):Q(a);(f===N&&F||f===R&&!F||X)&&r.forEach(function(e){Ae(e,i,"silent")})}},i.afterLoad=function(){if((!m.scrollBar||!m.autoScrolling||g.usingExtension("dragAndMove"))&&((V||l)&&(ae(),V=!1),!k)){var t=Z(H)[f].offsetNormal,e=H?K(v(S)[0]):Q(v(S)[0]);(f===N&&H||f===R&&!H)&&e.forEach(function(e){Le(e,t,"silent")})}},i.c=g.c;var Ne=i["common".charAt(0)];return"complete"===document.readyState&&Ne("parallax"),window.addEventListener("load",function(){Ne("parallax")}),i};